/*
 * Copyright (c) 2011, 2012 Alexander Kluth <alexander.kluth@outlook.com>
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */
package hardyhttp.filesystem;

import org.yaml.snakeyaml.*;
import java.io.*;
import java.util.Map;

/**
 *
 * @author alexander
 */
public class YAMLParser 
{
    private Yaml yaml;
    private Map<String, Object> contents;
    
    public YAMLParser() 
    {
        yaml = new Yaml();
    }
    
    /**
     * Load the file
     * 
     * @param filename File to load
     * @return true if loading was successful, false otherwise
     */
    public boolean loadFile(String filename) throws FileNotFoundException
    {
        InputStream is = new FileInputStream(new File(filename));
        
        
        contents = (Map<String, Object>) yaml.load(is);

        return false;
    }
    
    
    /**
     * Return the parsed YAMl list
     * 
     * @return The parsed YAML list
     */
    public Map getYamlList() 
    {
        return contents;
    }
}
